/*
 * @Author: yxfan
 * @Date: 2024-12-16 18:31:34
 * @LastEditTime: 2024-12-16 19:27:27
 * @FilePath: /umi-demo/src/pages/test/redux/Son.jsx
 * @Description:
 */
import { memo } from 'react';
import { useSelector, useDispatch } from 'umi';
import { useBearStore } from './store';
export default () => {
    // const { num } = useSelector((state) => state.redux);
    const dispatch = useDispatch();
    const increasePopulation = useBearStore(
        (state) => state.increasePopulation,
    );
    // const bears = useBearStore((state) => state.bears);

    console.log('son render');
    function change() {
        dispatch({ type: 'redux/addNum', payload: 100 });
    }

    function change2() {
        increasePopulation();
    }

    return (
        <div>
            <h3>子组件</h3>
            <button onClick={change}>change</button>
            <button onClick={change2}>zustand change</button>
        </div>
    );
};
